package com.cloudptt.api.models.lbs;

public class LocationData {
	private double  lattitude  = 0;
	private double  longitude  = 0;
	private double  altitude = 0;
	
	public static LocationData getDefaultLocationData()
	{
		return new LocationData();
	}
	
	public LocationData(){}
	
	public LocationData(double lattitude,double longitude){
		this.lattitude = lattitude;
		this.longitude = longitude;
		this.altitude = 0;
	}
	
	public LocationData(double lattitude,double longitude, double height)
	{
		this.lattitude = lattitude;
		this.longitude = longitude;
		this.altitude = height;
	}
	
	public boolean isValid()
	{
		if(this.lattitude != 0
				&& this.longitude != 0)
		{
			return true;
		}
		
		return false;
	}
	
	public void updateLocationData(double lattitude,double longitude)
	{
		this.lattitude = lattitude;
		this.longitude = longitude;
	}
	
	public void updateLocationData(double lattitude,double longitude, double altitude){
		this.lattitude = lattitude;
		this.longitude = longitude;
		this.altitude = altitude;
	}

	public double getLattitude() {
		return lattitude;
	}

	public double getLongitude() {
		return longitude;
	}
	
	public double getAltitude(){
		return altitude;
	}
	
	public void setLattitude(double lattitude) {
		this.lattitude = lattitude;
	}
	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}
	
	public void setAltitude(double altitude){
		this.altitude = altitude;
	}
	
	public String toString()
	{
		StringBuffer strBuff = new StringBuffer();
		strBuff.append("<Cu>");
		
		strBuff.append("<Lo type=\"Normal\">");
		strBuff.append(longitude);
		strBuff.append("</Lo>");
	
		strBuff.append("<La type=\"Normal\">");
		strBuff.append(lattitude);
		strBuff.append("</La>");
		
		strBuff.append("</Cu>");
//		strBuff.append(" lattitude = ").append(lattitude);
//		strBuff.append(" longitude = ").append(longitude);
//		strBuff.append(" height = ").append(altitude);
//		
		return strBuff.toString();
	}
}
